Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pRPC AllowHandoverTo #1500

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Add pRPC AllowHandoverTo #1500

wants to merge 10 commits into from

Conversation

kvinwang
Copy link
Collaborator

@kvinwang kvinwang commented Dec 26, 2023

This PR adds a pruntime RPC named AllowHandoverTo. It allows the council members to sign a new version of pRuntime in order to enable them to hand over the key when pRuntime encounters issues syncing block data.

This is part of #1499.

Usage

Suppose we have two version of pRuntime A and B, where A is stucked, and we want to force handover to B.

SGX MR of A: 0x10c24c0e6bf8a86634417fcd8f934e62439c62907a6f1bc726906a50b054ddf10000000083d719e77deaca1470f6baf62a4d774303c899db69020f9c70ee1dfc08c7ce9e
SGX MR of B: 0xf42f7e095735702d1d3c6ac5fa3b4581d3c3673d3c5ce261a43fe782ccb3e1dc0000000083d719e77deaca1470f6baf62a4d774303c899db69020f9c70ee1dfc08c7ce9e
Genisis block hash: 0x0a15d23307d533d581291ff6dedca9ca10927c7dff6f4df9e8c3bf00bc5a6ded (Can be got via get_info)

Then the steps would be:

  1. Ask at least half of the council members to sign a message as below:
Allow pRuntime to handover
 from: 0x10c24c0e6bf8a86634417fcd8f934e62439c62907a6f1bc726906a50b054ddf10000000083d719e77deaca1470f6baf62a4d774303c899db69020f9c70ee1dfc08c7ce9e
 to: 0xf42f7e095735702d1d3c6ac5fa3b4581d3c3673d3c5ce261a43fe782ccb3e1dc0000000083d719e77deaca1470f6baf62a4d774303c899db69020f9c70ee1dfc08c7ce9e
 genesis: 0x0a15d23307d533d581291ff6dedca9ca10927c7dff6f4df9e8c3bf00bc5a6ded

See https://files.kvin.wang:8443/signit/ for an example

  1. Collect the signatures and assamble them into a rpc request like this:
    $ cat sigs.json
    {
        "measurement": "f42f7e095735702d1d3c6ac5fa3b4581d3c3673d3c5ce261a43fe782ccb3e1dc0000000083d719e77deaca1470f6baf62a4d774303c899db69020f9c70ee1dfc08c7ce9e",
        "signatures": [
            {
                "signature": "fe6eeb25c088975df9bd136cc29c01a1b0bec3c4a58027efd7ca2908b233983c908a7159b81e265948a45e2c9129560f96aef24b93612f1dd4fc9aa40880ff88",
                "signature_type": 4,
                "pubkey": "d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"
            },
            {
                "signature": "22591a9f308e9d1a2af2ad103334cf8ab3674a2dab9e9a6372cf1e09c8671066668ed90af1c88ad7c5c280b8e5dfb043402774cf59e38d312ee107bd8aee2f8c",
                "signature_type": 4,
                "pubkey": "8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48"
            }
        ]
    }
    
  2. Load the sigs.json to pruntime A
    $ curl -d @sigs.json  localhost:8000/prpc/PhactoryAPI.AllowHandoverTo?json
    
  3. Run a new pruntime B instance to start the handover
    $ ./gramine-sgx pruntime --request-handover-from http://localhost:8000

@kvinwang kvinwang force-pushed the council-signed-handover branch 3 times, most recently from 41591a2 to fb2640e Compare December 27, 2023 10:32
@kvinwang kvinwang marked this pull request as ready for review December 27, 2023 11:01
Copy link
Contributor

@shelvenzhou shelvenzhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from ident-addr-mapping to master January 5, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants